﻿using Sunny.UI;
using System;
using System.Drawing;

namespace SeeSharpTools.Demo.GUI
{
    public partial class FormBoolean : UIPage
    {
        public FormBoolean()
        {
            InitializeComponent();

            knobControl1.Value = 30;
            slide_glossiness.Value = 80;
            slide_value.Value = 70;
        }

        private void checkBox_reversed_CheckedChanged(object sender, EventArgs e)
        {
            tank1.Reversed = checkBox_reversed.Checked;
        }

        private void knobControl1_ValueChanging(object Sender)
        {
            tank1.Reversed = checkBox_reversed.Checked;
            tank1.Value = knobControl1.Value;
            thermometer1.Value = knobControl1.Value;

            if (knobControl1.Value <= 30)
            {
                tank1.ForeColor = Color.Blue;
                thermometer1.ForeColor = Color.Green;
            }
            if (30 < knobControl1.Value && knobControl1.Value <= 70)
            {
                tank1.ForeColor = Color.Green;
                thermometer1.ForeColor = Color.Red;
            }
            if (knobControl1.Value > 70)
            {
                tank1.ForeColor = Color.Red;
                thermometer1.ForeColor = Color.Red;
            }
        }

        private void knobControl2_ValueChanged(object Sender)
        {
            tank1.Reversed = checkBox_reversed.Checked;
            tank1.Value = knobControl2.Value;
            thermometer1.Value = knobControl2.Value;

            if (knobControl2.Value <= 30)
            {
                tank1.ForeColor = Color.Blue;
                thermometer1.ForeColor = Color.Green;
            }
            if (30 < knobControl2.Value && knobControl2.Value <= 70)
            {
                tank1.ForeColor = Color.Green;
                thermometer1.ForeColor = Color.Red;
            }
            if (knobControl2.Value > 70)
            {
                tank1.ForeColor = Color.Red;
                thermometer1.ForeColor = Color.Red;
            }
        }

        private void slide_value_ValueChanged(object sender, double value)
        {
            aquaGauge1.Value = slide_value.Value;
            pressureGauge1.Value = slide_value.Value;
        }

        private void slide_glossiness_ValueChanged(object sender, double value)
        {
            aquaGauge1.Glossiness = (float)slide_glossiness.Value;
            pressureGauge1.Glossiness = (float)slide_glossiness.Value;
        }
    }
}